package com.jha.framework.report.adapter;

import com.alibaba.fastjson.JSONObject;
import org.jeecg.modules.jmreport.desreport.render.handler.convert.ApiDataConvertAdapter;
import org.springframework.stereotype.Component;

@Component("reportDataConvertAdapter")
public class ReportDataConvertAdapter implements ApiDataConvertAdapter {
    @Override
    public String getData(JSONObject jsonObject) {

        if(jsonObject.containsKey("data")){
            String data = jsonObject.getString("data");
            return data;
        }else if(jsonObject.containsKey("rows")){
            return jsonObject.getString("rows");
        }else {
            return jsonObject.toJSONString();
        }
    }
}
